package com.mind.adjust.service.impl;

import com.mind.customer.mapper.AjReportResultMapper;
import com.mind.system.domain.AjReportResult;
import com.mind.adjust.service.AjReportResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 报告结果(AjReportResult)表服务实现类
 *
 * @author makejava
 * @since 2024-07-28 13:55:45
 */
@Service("reportResultService")
public class AjReportResultServiceImpl implements AjReportResultService {
    @Autowired
    private AjReportResultMapper reportResultMapper;

    /**
     * 查询报告结果信息集合
     * 
     * @param reportResult 报告结果信息
     * @return 报告结果信息集合
     */
    @Override
    public List<AjReportResult> selectReportResultList(AjReportResult reportResult)
    {
        return reportResultMapper.selectReportResultList(reportResult);
    }

    /**
     * 通过报告结果ID查询报告结果信息
     * 
     * @param reportResultId 报告结果ID
     * @return 角色对象信息
     */
    @Override
    public AjReportResult selectReportResultById(Long reportResultId)
    {
        return reportResultMapper.selectReportResultById(reportResultId);
    }

    /**
     * 删除报告结果信息
     * 
     * @param reportResultId 报告结果ID
     * @return 结果
     */
    @Override
    public int deleteReportResultById(Long reportResultId)
    {
        return reportResultMapper.deleteReportResultById(reportResultId);
    }

    /**
     * 批量删除报告结果信息
     * 
     * @param reportResultIds 需要删除的报告结果ID
     * @return 结果
     */
    @Override
    public int deleteReportResultByIds(Long[] reportResultIds)
    {
        return reportResultMapper.deleteReportResultByIds(reportResultIds);
    }

    /**
     * 新增保存报告结果信息
     * 
     * @param reportResult 报告结果信息
     * @return 结果
     */
    @Override
    public int insertReportResult(AjReportResult reportResult)
    {
        return reportResultMapper.insertReportResult(reportResult);
    }

    /**
     * 修改保存报告结果信息
     * 
     * @param reportResult 报告结果信息
     * @return 结果
     */
    @Override
    public int updateReportResult(AjReportResult reportResult)
    {
        return reportResultMapper.updateReportResult(reportResult);
    }
    
    /**
     * 批量插入
     *
     * @param reportResultList 附件类型信息
     * @return 结果
     */
    @Override
    public int batchInsert(List<AjReportResult> reportResultList) {
        int size = 0;
        for(AjReportResult reportResult: reportResultList) {
            if (reportResultMapper.selectReportResultByName(reportResult.getName()) == null){
                reportResultMapper.insertReportResult(reportResult);
                size ++;
            }
        }
        return size;
    }
}
